//主页面
import React from 'react';
import { LaptopOutlined, UserOutlined } from '@ant-design/icons';
import { Layout, Menu, theme } from 'antd';
import { Outlet, useNavigate } from 'react-router-dom';
const { Content, Sider } = Layout;

const items2 = [
    {
        label: '询价巡查',
        key: 'security',
        icon: <UserOutlined />,
        children: [
            {
                label: '日常巡查',
                key: 'security/dailyInspection',
            },
            {
                label: '定期检查',
                key: 'security/regularInspection',
                children: [
                    {
                        label: '定期检查',
                        key: 'security/regularInspection/table',
                    },
                    {
                        label: '发起定期检查',
                        key: 'security/regularInspection/sendtable',
                    }
                ]
            },
            {
                label: '特别检查',
                key: 'security/indexSpecial',
                children: [
                    {
                        label: '特别检查',
                        key: 'security/indexSpecial/specialInspection',
                    },
                    {
                        label: '发起特别检查',
                        key: 'security/indexSpecial/addSpecialInspection',
                    }
                ]
            },
            {
                label: '安全检查',
                key: 'security/safetyInspection',
            }
        ],
    },
    {
        label: '维修养护',
        key: 'maintenance',
        icon: <LaptopOutlined />,
        children: [
            {
                label: '日常维修',
                key: 'maintenance/DailyMaintenance',
                children: [
                    {
                        label: '日常维修',
                        key: 'maintenance/DailyMaintenance/indexDaily',
                    },
                    {
                        label: '发起日常维修',
                        key: 'maintenance/DailyMaintenance/addDailyMaintenance',
                    },
                    {
                        label: '待审核',
                        key: 'maintenance/DailyMaintenance/Audit',
                    }
                ]
            },
            // {
            //     label: '日常养护',
            //     key: 'maintenance/DailyMaintenance1',
            // },
        ],

    },
    {
        label: '应急管理',
        key: 'emergency',
        icon: <UserOutlined />,
        children: [
            {
                label: '应急预案',
                key: 'emergency/emergencyPlan',
            },
            {
                label: '应急响应',
                key: 'emergency/emergencyResponse',
            },
            {
                label: '应急演练',
                key: 'emergency/emergencyExercise',
            },
            {
                label: '物资库存',
                key: 'emergency/emergencyStock',
            },
            {
                label: '出入库管理',
                key: 'emergency/wareHouse',

            }
        ]
    },
    {
        label: '隐患中心',
        key: 'hiddenDanger',
        icon: <UserOutlined />,
        children: [
            {
                label: '指派人员',
                key: 'hiddenDanger/hiddenDangerAssignPerson',
            },
            {
                label: '隐患发起维修或者养护',
                key: 'hiddenDanger/hiddenDangerRepair',
            },
            {
                label: '隐患发起维修上报结果',
                key: 'hiddenDanger/hiddenDangerRepairResult',
            },
            {
                label: '审核',
                key: 'hiddenDanger/hiddenDangerAudit',
            },
        ]
    }
]


const App: React.FC = () => {
    const {
        token: { colorBgContainer, borderRadiusLG },
    } = theme.useToken();

    const navigate = useNavigate()
    const dian = (val: any) => {
        navigate(val.key)
    }

    return (
        <Layout>
            <Layout>
                <Sider width={200} style={{ background: colorBgContainer }}>
                    <Menu
                        mode="inline"
                        defaultSelectedKeys={['security/dailyInspection']}
                        defaultOpenKeys={['security/dailyInspection']}
                        style={{ height: '100%', borderRight: 0 }}
                        items={items2}
                        onClick={dian}
                    />
                </Sider>
                <Layout style={{ padding: '0 24px 24px' }}>
                    <Content
                        style={{
                            // padding: 24,
                            margin: 0,
                            minHeight: "88vh",
                            background: colorBgContainer,
                            borderRadius: borderRadiusLG,
                        }}
                    >
                        <Outlet></Outlet>
                    </Content>
                </Layout>
            </Layout>
        </Layout>
    );
};

export default App;